package com.exam.api.common.baseModule.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

@Schema
@Data
public abstract class BaseDomain {

    /**
     * 主键：
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "")
    private Long id;

    /**
     * 是否删除
     */
    @Schema(description = "是否删除")
    @TableField(value = "is_delete", select = false)
    @TableLogic(value = "0", delval = "1")
    private Integer isDelete;

    /**
     * 创建人id
     */
    @Schema(description = "创建人id")
    @TableField(value = "create_user_id", fill = FieldFill.INSERT)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long createUserId;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 更新人id
     */
    @Schema(description = "更新人id")
    @TableField(value = "update_user_id", fill = FieldFill.UPDATE)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long updateUserId;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间")
    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    private LocalDateTime updateTime;
}
